/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2021-03-17
 * Time: 22:47
 */
#ifndef CODSEEGMENT_MAINWINDOW_H
#define CODSEEGMENT_MAINWINDOW_H

#include "DiagramScene.h"
#include "DiagramView.h"

#include <QWidget>

class MainWindow
        : public QMainWindow
{
Q_OBJECT

public:
    enum ActionIndex { NewAction = 0, OpenAction, SaveAction, SaveAsAction, CloseAction};
    explicit MainWindow(QWidget *parent = nullptr);

    ~MainWindow() override;

private:
    void InitUi();
    void InitEvent();
    void InitAction();
    void InitMenu();
public slots:
    bool SlotNewDiagram();
    bool SlotOpenDiagram();
    bool SlotSaveDiagram();
    bool SlotSaveDiagramAs();
    bool SlotCloseDiagram();

    bool SlotLoadDiagram(const QString& filePath);
private slots:

signals:
    void SignalVisibilityChanged(bool visible);
    void SignalDiagramViewCleared();

private:
    QAction* AddAction(const QString& text, QObject* slotObj, const char* slotFunction, const QString& shortcut = QString());
private:
    DiagramScene *          diagram_scene_;
    DiagramView *           diagram_view_;

};

#endif //CODSEEGMENT_MAINWINDOW_H
